<!DOCTYPE html>
<html>
<head>
    <title>系统列表</title>
    <#include "/common/import.ftl" >
    <script>
        $(function () {
            $('#sysList').datagrid({
                title: '系统列表',
                url: '${ctx}/uct/sys/sys!data.action',
                loadMsg: '数据载入中，请稍后……',
                nowrap: false,
                collapsible: false,
                fitColumns: true,
                pagination: true,
                singleSelect: true,
                rownumbers: true,
                remoteSort: false,
                pageList: [10, 15, 20, 50],
                idField: 'sysId',
                frozenColumns: [[{
                    title: '中文名称',
                    field: 'sysCname',
                    width: 200,
                    formatter: function (value) {
                        return '<span style="color:blue">' + value + '</span>';
                    }
                }]],
                columns: [[{
                    field: 'sysEname',
                    title: '英文标识',
                    width: 100,
                    sorter: function (a, b) {
                        return (a > b ? 1 : -1);
                    }
                }, {
                    field: 'orderNum',
                    title: '排序',
                    width: 100,
                    sorter: function (a, b) {
                        return (a > b ? 1 : -1);
                    }
                }, {
                    field: 'createTime',
                    title: '创建时间',
                    width: 100,
                    sorter: function (a, b) {
                        return (a > b ? 1 : -1);
                    },
                    formatter: function (value) {
                        return getFormatDateByLong(value, "yyyy-MM-dd hh:mm:ss");
                    }
                }, {
                    field: 'createUser',
                    title: '创建人',
                    width: 100
                }]],

                toolbar: [{
                    text: '访问控制管理',
                    iconCls: 'icon-edit',
                    handler: function () {
                        lockList();
                    }
                }, '-',

                    {
                        text: '刷新',
                        iconCls: 'icon-reload',
                        handler: function () {
                            reload('');
                        }
                    }],
                onDblClickRow: function (row) {
                    lockList();
                }
            });
        });

        function getSelected() {
            var selected = $('#sysList').datagrid('getSelected');
            if (selected) {
                return selected;
            } else {
                $.messager.alert('提示', '请选择要操作的系统', 'info');
            }
        }

        function reload() {
            $('#sysList').datagrid('reload');
        }

        function lockQuery() {
            var queryParams = $('#sysList').datagrid('options').queryParams;
            queryParams.sysCname = $('#sysCname').val();
            queryParams.sysEname = $('#sysEname').val();
            reload();
        }

        function lockList() {
            var node = getSelected();
            if (node) {
                var editLockUrl = '${ctx}/uct/lock/list.action?sysId=' + node.sysId + '&sysEname=' + node.sysEname;
                window.location.href = editLockUrl;
            }
        }

        function clearQuery() {
            $('#sysCname').val('');
            $('#sysEname').val('');
            lockQuery();
        }


    </script>
</head>

<body>
<table class="planel-body">
    <tr>
        <td>中文名称</td>
        <td>
            <input name="sysCname" id="sysCname" value=""/>
        </td>
        <td>英文标识</td>
        <td>
            <input name="sysEname" id="sysEname" value=""/>
        </td>
        <td>
            <a class="easyui-linkbutton" iconCls="icon-search"
               onclick="lockQuery();">查询</a>
            <a class="easyui-linkbutton" iconCls="" onclick="clearQuery();">清空</a>
        </td>
    </tr>
</table>

<table id="sysList"></table>
</body>
</html>